package com.design.util.moveBox;

import java.awt.*;

public class Box {
    private final int x;
    private final int y;
    private Picture picture;
    private char name;
    public Box(Picture picture,int x,int y){
        this.rename(picture);
        this.x = x;
        this.y = y;
    }
    public char getName() {
        return name;
    }
    public boolean equal(char name){
        return this.name == name;
    }
    public boolean equals(char[] names){
        for (char name : names) {
            if(this.equal(name)){
                return true;
            }
        }
        return false;
    }
    public int getX() {
        return x;
    }
    public int getY() {
        return y;
    }
    public void fill(Graphics g, int width){
        this.fill(g,width,0,0);
    }
    public void fill(Graphics g,int width,int playX,int playY){
        this.picture.fill(g,this.x * width + playX,this.y * width + playY,width);
    }
    public void rename(Picture picture){
        this.picture = picture;
        this.name = picture.getName();
    }
}
